package com.mdz.sbgl.Controller;

import com.mdz.sbgl.Entity.Sysobjects;
import com.mdz.sbgl.Mapper.SysobjectsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 参数配置表 前端控制器
 * </p>
 *
 * @author 孟德志
 * @since 2020-09-06
 */
@Controller
@RequestMapping("/sbgl/sysobjects")
public class SysobjectsController {

    @Autowired
    private SysobjectsMapper sysobjectsMapper;

    @ResponseBody
    @RequestMapping(value = "/deletedb/{gsid}", method = RequestMethod.GET)
    public Integer deletedb(@PathVariable("gsid") String gsid){
        List<Sysobjects> sysobjectsList=sysobjectsMapper.getdbname();
        Integer flag=0;
        for (int i=0;i<sysobjectsList.size();i++){
            flag=sysobjectsMapper.deletedb(sysobjectsList.get(i).getDbname(),gsid);
            System.out.println(flag);
        }
        return flag;
    }
}
